package com.eric.hadoop;

import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import java.io.File;

/**
 * @author chenw-i
 * @version 1.0.0
 * @ClassName HDApplication.java
 * @Description TODO
 * @createTime 2021年05月10日 17:36:00
 */
@SpringBootApplication
public class HDApplication implements ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        HDFSService service = applicationContext.getBean(HDFSService.class);
        boolean success = service.mkdirFolder("/user/config");
        System.out.println("mkdirFolder : "+success);
        service.createFile("/user/config",new File("/home/eric/ohmyzsh/oh-my-zsh.sh"));
        System.out.println("createFile");
    }

    public static void main(String[] args) {
        SpringApplication.run(HDApplication.class ,args);
    }
}
